package com.prs.crm.service.pm.impl;

import java.io.File;
import java.util.Collection;

import com.prs.crm.context.FileUtil;
import com.prs.crm.dao.pm.PmStageDao;
import com.prs.crm.domain.Attachment;
import com.prs.crm.domain.pm.PmProject;
import com.prs.crm.domain.pm.PmStage;
import com.prs.crm.service.impl.FlowServiceImpl;
import com.prs.crm.service.pm.PmStageService;

public class PmStageServiceImpl extends FlowServiceImpl<PmStage,PmStageDao> implements PmStageService{
	@Override
	public boolean valideSubmit(PmStage pmStage)
	{
		return true;
	}

	@Override
	public Collection<PmStage> getRootStage(PmProject project) {
		// TODO Auto-generated method stub
		return this.getDao().getRootStage(project);
	}

	@Override
	public void submitStage(PmStage pmStage, File file, String fileName) {
		// TODO Auto-generated method stub
		Attachment attach = FileUtil.getInstance().createAttach(file, fileName);
		pmStage.setAttach(attach);
		this.save(pmStage);
	}

	@Override
	public Collection<PmStage> getPeerStage(PmProject project,
			PmStage parentStage) {
		// TODO Auto-generated method stub
		return this.getDao().getPeerStage(project,parentStage);
	}

}
